package thread;

public class ThreadDemo2 {
    public static void main(String[] args) {
        Runnable1 r1 = new Runnable1();
        Runnable2 r2 = new Runnable2();
        Thread t1 = new Thread(r1);
        Thread t2 = new Thread(r2);
        t1.start();
        t2.start();
    }
}
class Runnable1 implements java.lang.Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("开心");
        }
    }
}
class Runnable2 implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("高兴");
        }
    }
}
